var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("AssetsManager"),
    r = e("RoleSoldierInfo"),
    s = cc._decorator,
    l = s.ccclass,
    _ = s.property,
    c = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.my_info_node = null),
                (t.name_label = null),
                (t.head_sprite = null),
                (t.kill_info_label = null),
                (t.equip_node = null),
                (t.grade_sprite = null),
                (t.coin_num_label = null),
                (t.equip_view_node = null),
                (t.level_num = null),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.initView = function () {
                e.prototype.initView.call(this);
            }),
            (t.prototype.showPlayerInfo = function (e) {
                this.initView();
                var t = n.GlobalParams.MatchGamePlayer[e];
                (this.my_info_node.active = e == n.GlobalParams.MatchMyIndex),
                    (this.name_label.string = t.name),
                    (this.name_label.node.color =
                        e == n.GlobalParams.MatchMyIndex ? cc.color(20, 255, 50) : cc.color(255, 233, 77)),
                    (this.head_sprite.spriteFrame = i.default
                        .getInstance()
                        .getHeroHeadFrame("hero_" + r.default.Role_info[t.role_id].id)),
                    this.coin_num_label && (this.coin_num_label.string = "" + t.coin),
                    (this.kill_info_label.string = t.kill_info[0] + " / " + t.kill_info[1] + " / " + t.kill_info[2]);
                var o = 2 * t.kill_info[0] - t.kill_info[1] + 0.5 * t.kill_info[2],
                    a = this.getGradeType(o);
                if (
                    ((this.grade_sprite.spriteFrame = i.default.getInstance().getGradeTypeFrame("grade_" + a)),
                        e == n.GlobalParams.MatchMyIndex)
                ) {
                    5 == a && this.uiManager.playerTaskOverInfo(9, 1);
                    var s = n.GlobalParams.FightDataInfo.value;
                    (s.data_info[a] += 1), (n.GlobalParams.FightDataInfo.value = s);
                }
                for (var l = 0; l < this.equip_view_node.childrenCount; l++)
                    this.equip_view_node.children[l].children[0].getComponent(cc.Sprite).spriteFrame =
                        0 == t.equip_info[l]
                            ? null
                            : i.default.getInstance().getEquipIconFrame("equip_" + t.equip_info[l]);
                this.level_num.string = "" + t.level;
            }),
            (t.prototype.getGradeType = function (e) {
                return e < 5 ? 0 : e < 10 ? 1 : e < 20 ? 2 : e < 30 ? 3 : 4;
            }),
            oo([_(cc.Node)], t.prototype, "my_info_node", void 0),
            oo([_(cc.Label)], t.prototype, "name_label", void 0),
            oo([_(cc.Sprite)], t.prototype, "head_sprite", void 0),
            oo([_(cc.Label)], t.prototype, "kill_info_label", void 0),
            oo([_(cc.Node)], t.prototype, "equip_node", void 0),
            oo([_(cc.Sprite)], t.prototype, "grade_sprite", void 0),
            oo([_(cc.Label)], t.prototype, "coin_num_label", void 0),
            oo([_(cc.Node)], t.prototype, "equip_view_node", void 0),
            oo([_(cc.Label)], t.prototype, "level_num", void 0),
            oo([l], t)
        );
    })(a.default);
o.default = c;
